Skip to main content

MPUSP/snakemake-bacterial-riboseq

Bacterial-Riboseq: A Snakemake workflow for the analysis of riboseq data in bacteria.

Overview

Topics: bioinformatics-pipeline conda riboseq ribosome-profiling singularity snakemake workflow

Latest release: v1.4.0, last update: 2025-02-02

Linting: passed

Formatting: passed

Configuration

snakemake-bacterial-riboseq

Usage

The usage of this workflow is described in the Snakemake Workflow Catalog.

If you use this workflow in a paper, don't forget to give credits to the authors by citing the URL of this (original) repository and its DOI (see above).

Workflow overview

This workflow is a best-practice workflow for the analysis of ribosome footprint sequencing (Ribo-Seq) data. The workflow is built using snakemake and consists of the following steps:

  1. Obtain genome database in fasta and gff format (python, NCBI Datasets)
    1. Using automatic download from NCBI with a RefSeq ID
    2. Using user-supplied files
  2. Check quality of input sequencing data (FastQC)
  3. Cut adapters and filter by length and/or sequencing quality score (cutadapt)
  4. Deduplicate reads by unique molecular identifier (UMI, umi_tools)
  5. Map reads to the reference genome (STAR aligner)
  6. Sort and index for aligned seq data (samtools)
  7. Filter reads by feature type (bedtools)
  8. Generate summary report for all processing steps (MultiQC)
  9. Shift ribo-seq reads according to the ribosome's P-site alignment (R, ORFik)
  10. Calculate basic gene-wise statistics such as RPKM (R, ORFik)
  11. Return report as HTML and PDF files (R markdown, weasyprint)

If you want to contribute, report issues, or suggest features, please get in touch on github.

Installation

Step 1: Clone this repository

git clone https://github.com/MPUSP/snakemake-bacterial-riboseq.git
cd snakemake-bacterial-riboseq

Step 2: Install dependencies

It is recommended to install snakemake and run the workflow with conda, mamba or micromamba.

# download Miniconda3 installer
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
# install Conda (respond by 'yes')
bash miniconda.sh
# update Conda
conda update -y conda
# install Mamba
conda install -n base -c conda-forge -y mamba

Step 3: Create snakemake environment

This step creates a new conda environment called snakemake-bacterial-riboseq.

# create new environment with dependencies & activate it
mamba create -c conda-forge -c bioconda -n snakemake-bacterial-riboseq snakemake pandas
conda activate snakemake-bacterial-riboseq

Note:

All other dependencies for the workflow are automatically pulled as conda environments by snakemake, when running the workflow with the --use-conda parameter (recommended).

Running the workflow

Input data

Reference genome

An NCBI Refseq ID, e.g. GCF_000006945.2. Find your genome assembly and corresponding ID on NCBI genomes. Alternatively use a custom pair of *.fasta file and *.gff file that describe the genome of choice.

Important requirements when using custom *.fasta and *.gff files:

  • *.gff genome annotation must have the same chromosome/region name as the *.fasta file (example: NC_003197.2)
  • *.gff genome annotation must have gene and CDS type annotation that is automatically parsed to extract transcripts
  • all chromosomes/regions in the *.gff genome annotation must be present in the *.fasta sequence
  • but not all sequences in the *.fasta file need to have annotated genes in the *.gff file

Read data

Ribosome footprint sequencing data in *.fastq.gz format. The currently supported input data are single-end, strand-specific reads. Input data files are supplied via a mandatory table, whose location is indicated in the config.yml file (default: samples.tsv). The sample sheet has the following layout:

sampleconditionreplicatedata_folderfq1
RPF-RTP1RPF-RTP1dataRPF-RTP1_R1_001.fastq.gz
RPF-RTP2RPF-RTP2dataRPF-RTP2_R1_001.fastq.gz

Some configuration parameters of the pipeline may be specific for your data and library preparation protocol. The options should be adjusted in the config.yml file. For example:

  • Minimum and maximum read length after adapter removal (see option cutadapt: default). Here, the test data has a minimum read length of 15 + 7 = 22 (2 nt on 5'end + 5 nt on 3'end), and a maximum of 45 + 7 = 52.
  • Unique molecular identifiers (UMIs). For example, the protocol by McGlincy & Ingolia, 2017 creates a UMI that is located on both the 5'-end (2 nt) and the 3'-end (5 nt). These UMIs are extracted with umi_tools (see options umi_extraction: method and pattern).

Example configuration files for different sequencing protocols can be found in resources/protocols/.

Execution

To run the workflow from command line, change the working directory.

cd path/to/snakemake-bacterial-riboseq

Adjust options in the default config file config/config.yml. Before running the entire workflow, you can perform a dry run using:

snakemake --dry-run

To run the complete workflow with test files using conda, execute the following command. The definition of the number of compute cores is mandatory.

snakemake --cores 10 --use-conda --directory .test

Parameters

This table lists all parameters that can be used to run the workflow.

parametertypedetailsdefault
samplesheet
pathstrpath to samplesheet, mandatory"config/samples.tsv"
get_genome
databasestrone of manual, ncbincbi
assemblystrRefSeq IDGCF_000006785.2
fastastroptional path to fasta fileNull
gffstroptional path to gff fileNull
gff_source_typestrlist of name/value pairs for GFF sourcesee config file
cutadapt
fivep_adapterstrsequence of the 5' adapterNull
threep_adapterstrsequence of the 3' adapterATCGTAGATCGGAAGAGCACACGTCTGAA
defaultstradditional options passed to cutadapt[-q 10 , -m 22 , -M 52, --overlap=3]
umi_extraction
methodstrone of string or regex, see manualregex
patternstrstring or regular expression^(?P<umi_0>.{5}).*(?P<umi_1>.{2})$
umi_dedup
optionsstrdefault options for deduplicationsee config file
star
indexstrlocation of genome index; if Null, is madeNull
genomeSAindexNbasesnumlength of pre-indexing string, see STAR man9
multinummax number of loci read is allowed to map10
sam_multinummax number of alignments reported for read1
intron_maxnummax length of intron; 0 = automatic choice1
defaultstrdefault options for STAR alignersee config file
extract_features
biotypesstrbiotypes to exclude from mapping[rRNA, tRNA]
CDSstrCDS type to include for mapping[protein_coding]
bedtools_intersect
defaultsstrremove hits, sense strand, min overlap 20%[-v , -s , -f 0.2]
annotate_orfs
window_sizenumsize of 5'-UTR added to CDS30
shift_reads
window_sizenumstart codon window to determine shift30
read_lengthnumsize range of reads to use for shifting[27, 45]
end_alignmentstrend used for alignment of RiboSeq reads3prime
shift_tablestroptional table with offsets per read lengthNull
export_bigwigstrexport shifted reads as bam fileTrue
export_ofststrexport shifted reads as ofst fileFalse
skip_shiftingstrskip read shifting entirelyFalse
skip_length_filterstrskip filtering reads by lengthFalse
multiqc
configstrpath to multiqc configconfig/multiqc_config.yml
report
export_figuresboolexport figures as .svg and .pngTrue
export_dirstrsub-directory for figure exportfigures/
figure_widthnumstandard figure width in px875
figure_heightnumstandard figure height in px500
figure_resolutionnumstandard figure resolution in dpi125